﻿using System;
using System.IO;
using System.Net;

namespace HTTP
{
    public class Http
    {

        private WebClient webClient;
        private Stream webStream;
        private StreamReader webStreamReader;

        public Http()
        {
            webClient = new WebClient();
        }

        public string OpenStream(string url)
        {
            try
            {
                webStream = webClient.OpenRead(url);
                webStreamReader = new StreamReader(webStream);
                return webStreamReader.ReadToEnd();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception:" + ex);
            }
            return "meep :(";
        }

        public void CloseStream()
        {
            webStream.Close();
        }
    }
}
